package com.example.tests;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import org.testng.annotations.Test;
import com.example.fw.GroupObject;
import com.example.fw.Groups;

public class GroupRemovalTests extends TestBase{
	@Test
	public void testFirstGroupCanBeRemoved() throws Exception {
		Groups oldList = app.getHibernateHelper().getGroups();
		GroupObject someGroup = oldList.getSomeGroup();
		app.getGroupHelper().deleteGroup(someGroup);
    	Groups newList = app.getHibernateHelper().getGroups();
		assertThat(newList, equalTo(oldList.withoutRemoved(someGroup)));
		
//		verifyGroupdeleted(oldList, newList);

	}
	@Test 
	public void testUiConfirmsDB(){
		Groups dbList = app.getHibernateHelper().getGroups();
		Groups uiList = app.getGroupHelper().getGroups();
		assertThat(dbList, equalTo(uiList));
	}
		
}
